/*
 * Copyright (c) 2016-2019 Hunan CNBOT Co., Ltd. All Rights Reserved.
 * FileName: ApiResponse.java
 * @author: yuxk
 * @date: 19-1-17 下午4:00
 * @version: 1.0
 */

package com.cnbot.httpsdk.bean;

import java.util.HashMap;

/**
 * @author yuxk
 * @version V1.0
 * @Title: Api信息返回工具类
 * @Description:
 * @date：2019/1/11 17:22
 */
public class ApiResponse {
    private int code;
    private String msg;
    private Object data = new HashMap<>();

    public ApiResponse() {

    }

    public ApiResponse(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ApiResponse success() {
        return new ApiResponse(0, "success", null);
    }

    public static ApiResponse success(Object data) {
        return new ApiResponse(0, "success", data);
    }

    public static ApiResponse fail(String msg) {
        return new ApiResponse(503, msg, null);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


}
